define(['jquery', 'bootstrap', 'utilback', 'table', 'form', 'myfileinput','zh'], function ($, undefined, Utilback, Table, Form,myfileInput,zh) {

    var Controller = {
    	config: {
    		get_url: '/user/read/detail', // 获取用户详情
    	},
        init: function () {
            // 初始化表格参数配置
            Table.api.init({
            	singleSelect: true,
                extend: {
                    index_url: './json/person.json', // 查询列表
                    add_url: 'tripStatisticAdd.html', // 新增页面
                    edit_url: 'tripStatisticAdd.html', // 修改页面
                    del_url: '/tripStatistic', // 删除
                    multi_url: '/tripStatistic',
                    audit_url:'tripStatisticAudit.html'
                }
            });
            var table = $("#userTable");

            // 初始化表格
            table.bootstrapTable({
                url: $.fn.bootstrapTable.defaults.extend.index_url,
                method:'get',
                columns: [
                    [
                        {field: 'state', checkbox: true, },
                        {field: 'id', title: 'ID'},
                        {field: 'workShop', title: '车间'},
                        {field: 'temgroup', title: "班组"},
                        {field: 'userName', title: "姓名"},
                        {field: 'idCard', title: "身份证号"},
                        {field: 'driverType', title: "司机类型"},
                        {field: 'tripNum', title: "出车次数"},
                        {field: 'rewardSystem', title: "奖罚制度"},
                        {field: 'status',title:'审核状态',formatter : function (value,row,index) {
							return Table.api.formatter.addtabs(value,row,index,$.fn.bootstrapTable.defaults.extend.audit_url);
						}},
                        {field: 'operate', title: __('Operate'), events: Table.api.events.operate, formatter: function (value, row, index) {
                                return Table.api.formatter.operate.call(this, value, row, index, table);
                            }}
                    ]
                ]
            });

            // 为表格绑定事件
            Table.api.bindevent(table);
            // 上传组件
           
         
           },

        edit: function () { // 初始化编辑页面
            Form.api.bindevent($("form[role=form]"));
            Form.api.fill($("form[role=form]"),'./json/person.json',1);
        	
        },
        update: function() {
            Form.api.bindevent($("form[role=form]"));
        	Util.api.ajax({
        		type: 'GET',
        		// url: '/user/read/current'
                url:'',
        	}, function(data) {
        		$('#edit-form').autofill(data);
        	});
        }
    };
    return Controller;
      function changeAgentContent(){
            document.getElementById("inputFileAgent").value
     = document.getElementById("inputFile").value;
    }
   
});